// https://andrebnassis.medium.com/setting-eslint-on-a-react-typescript-project-2021-1190a43ffba

{
    "env": {
        "browser": true,
        "es2021": true
    },
    "extends": [
        "plugin:react/recommended",
        "airbnb",
        "plugin:@typescript-eslint/recommended",
        "plugin:prettier/recommended",
        "plugin:import/typescript"
    ],
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        },
        "ecmaVersion": 12,
        "sourceType": "module"
    },

    "plugins": ["prettier", "react", "@typescript-eslint", "react-hooks", "import"],
    "rules": {
        "camelcase": "off",
        "@typescript-eslint/ban-ts-comment": "off",
        "no-use-before-define": "off",
        "no-param-reassign": "warn",
        "@typescript-eslint/no-use-before-define": ["error"],
        // https://stackoverflow.com/a/63961972
        "no-shadow": "off",
        "@typescript-eslint/no-shadow": ["error"],
        "import/no-extraneous-dependencies": "off",
        "@typescript-eslint/no-unused-vars": "warn",
        "react/jsx-filename-extension": ["warn", { "extensions": [".tsx"] }],
        "react/jsx-props-no-spreading": "off",
        "react/jsx-uses-react": "off",
        "react/jsx-indent": "off",
        "react/jsx-wrap-multilines": "off",
        "react/jsx-one-expression-per-line": "off",
        "react/react-in-jsx-scope": "off",
        "react/prop-types": "off",
        "react-hooks/rules-of-hooks": "error",
        "react-hooks/exhaustive-deps": "warn",
        "import/prefer-default-export": "off",
        "import/extensions": [
            "error",
            "ignorePackages",
            {
                "ts": "never",
                "tsx": "never"
            }
        ],
        "prettier/prettier": [
            "warn",
            {
                "parser": "typescript",
                "endOfLine": "crlf"
            }
        ]
    },
    "settings": {
        "import/parsers": {
            "@typescript-eslint/parser": [".ts", ".tsx"]
        },
        "import/resolver": {
            "typescript": {
                "project": true
            },
            "node": {
                "extensions": [".js", ".jsx", ".ts", ".tsx"]
            }
        }
    },
    "ignorePatterns": ["node_modules", "build", "config-overrides.js"]
}
